﻿using DiaoPaiDaYin;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Luna小店.DTO
{
    public class OrderStatusIndexDTO
    {
        public String orderId { get; set; }
        /**
         * 客户信息
         */
        public String customerId { get; set; }
        public String customerName { get; set; }
        public String mobile { get; set; }
        public String addressId { get; set; }
        public String addressProvince { get; set; }//省
        public String addressCity { get; set; }//市
        public String addressDistrict { get; set; }//区
        public String addressDetail { get; set; }//详细地址
        public String zipCode { get; set; }//邮编
        /**
         * 面料信息
         */
        public String materialNameCn { get; set; }//面料描述名称
        public String materialCode { get; set; }  //面料号
        public String composition { get; set; }//面料成分
        /**
         * 款式信息
         */
        public String styleSizeCd { get; set; }//尺码
        public String styleNameCn { get; set; }//款式名称
        public String refStyleId { get; set; }  //  标准款id
        /**
         * 订单信息
         */
        public String orderNo { get; set; } //  订单号
        public Double quantity { get; set; }    //  订单数量
        public DateTime orderDate { get; set; }//订单时间
        /**
         * 订单状态
         */
        public String orderStatus { get; set; } //  订单状态    @See top.toptimus.constValue.PMCOrderStatusConsts
        /**
         * 门店信息，也就是订单类别
         */
        public String shopId { get; set; }
        public String shopName { get; set; }

        public OrderStatusIndexDTO()
        {

        }
    }

    public class OrderStatusIndexDTOShow
    {
        public String ORDER_ID { get; set; }
        /**
         * 客户信息
         */
        public String CUSTOMER_ID { get; set; }
        public String CUSTOM_NAME { get; set; }
        public String MOBILE { get; set; }
        public String 收货人地址 { get; set; }
        public String addressId { get; set; }
        public String addressProvince { get; set; }//省
        public String addressCity { get; set; }//市
        public String addressDistrict { get; set; }//区
        public String addressDetail { get; set; }//详细地址
        public String zipCode { get; set; }//邮编
        /**
         * 面料信息
         */
        public String MATERIAL_NAME_CN { get; set; }//面料描述名称
        public String materialCode { get; set; }  //面料号
        public String composition { get; set; }//面料成分
        /**
         * 款式信息
         */
        public String STYLE_ID { get; set; }//款式id
        public String SIZE { get; set; }//尺码
        public String STYLE_NAME_CN { get; set; }//款式名称
        public String refStyleId { get; set; }  //  标准款id
        /**
         * 订单信息
         */
        public String ORDER_NO { get; set; } //  订单号
        public Double ORDER_NUMBER { get; set; }    //  订单数量
        public DateTime ORDER_DATE { get; set; }//订单时间
        public DateTime PAYMENT_DATE { get; set; }
        public String 收货人电话 { get; set; }
        public String 收货人姓名 { get; set; }
        /**
         * 订单状态
         */
        public String ITEM_NAME_CN { get; set; } //  订单状态    @See top.toptimus.constValue.PMCOrderStatusConsts
        /**
         * 门店信息，也就是订单类别
         */
        public String shopId { get; set; }
        public String shopName { get; set; }
        public String orderStatus { get; set; }

        public String REMARKS { get; set; }

        public OrderStatusIndexDTOShow(OrderStatusIndexDTO orderStatusdto)
        {
            this.ORDER_ID = orderStatusdto.orderId;
            this.CUSTOM_NAME = orderStatusdto.customerName;
            this.CUSTOMER_ID = orderStatusdto.customerId;
            this.MOBILE = orderStatusdto.mobile;
            this.收货人地址 = orderStatusdto.addressProvince + orderStatusdto.addressCity + orderStatusdto.addressDistrict + orderStatusdto.addressDetail;
            this.addressId = orderStatusdto.addressId;
            this.addressProvince = orderStatusdto.addressProvince; //省
            this.addressCity = orderStatusdto.addressCity;//市
            this.addressDistrict = orderStatusdto.addressDistrict;//区
            this.addressDetail = orderStatusdto.addressDetail;//详细地址
            this.zipCode = orderStatusdto.zipCode;//邮编
            /**
             * 面料信息
             */
            this.MATERIAL_NAME_CN = orderStatusdto.materialCode + orderStatusdto.materialNameCn;//面料描述名称
            this.materialCode = orderStatusdto.materialCode;  //面料号
            this.composition = orderStatusdto.composition;//面料成分
            /**
             * 款式信息
             */
            DataRow dataRow = SQLmtm.GetDataRow("SELECT STYLE_ID,REMARKS FROM o_order_p WHERE ORDER_ID='" + this.ORDER_ID + "';");
            this.STYLE_ID = dataRow["STYLE_ID"].ToString();
            this.REMARKS = dataRow["REMARKS"].ToString();
            this.SIZE = orderStatusdto.styleSizeCd; //尺码
            this.STYLE_NAME_CN = orderStatusdto.styleNameCn;//款式名称
            this.refStyleId = orderStatusdto.refStyleId;//  标准款id
            /**
             * 订单信息
             */
            this.ORDER_NO = orderStatusdto.orderNo;  //  订单号
            this.ORDER_NUMBER = orderStatusdto.quantity;     //  订单数量
            this.ORDER_DATE = orderStatusdto.orderDate; //订单时间
            this.PAYMENT_DATE = orderStatusdto.orderDate;
            this.收货人姓名 = orderStatusdto.customerName;
            this.收货人电话 = orderStatusdto.mobile;
            /**
             * 订单状态
             */
            switch (orderStatusdto.orderStatus)
            {
                case "NOT_SCHEDULED":
                    this.ITEM_NAME_CN = "未排产";
                    break;
                case "SCHEDULED":
                    this.ITEM_NAME_CN = "已排产";
                    break;
                case "DONE":
                    this.ITEM_NAME_CN = "完成";
                    break;
                case "CANCEL":
                    this.ITEM_NAME_CN = "取消";
                    break;
            }
            this.orderStatus = orderStatusdto.orderStatus; //  订单状态    @See top.toptimus.constValue.PMCOrderStatusConsts
            /**
             * 门店信息，也就是订单类别
             */
            this.shopId = orderStatusdto.shopId;
            this.shopName = orderStatusdto.shopName;
        }
    }
}
